<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      @keyframes ColorChange {
        0% {
          outline: 1px solid lightgreen;
        }

        50% {
          outline: 1px solid green;
        }

        100% {
          outline: 1px solid lightgreen;
        }
      }

      svg {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate3d(-50%, -50%, 0);
        outline: 1px solid red;
        animation: ColorChange 500ms ease infinite;
      }

      line,
      polyline,
      rect {
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      path {
        stroke-width: 1;
        fill: none;
        marker-start: url(#mCircle);
        marker-mid: url(#mArrow);
        marker-end: url(#mTriangle);
      }

      marker#mCircle path,
      marker#mArrow path,
      marker#mTriangle path {
        marker: none;
      }
    </style>
  </head>

  <body>
    <svg width="600"
         height="600"
         xmlns="http://www.w3.org/2000/svg"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         preserveAspectRatio="xMinYMin meet"
         stroke-linecap="round"
         stroke-linejoin="round"
         viewBox="0 0 600 600">
      <defs>
        <!--
          1.默认marker的开始位置(0,0)与开始位置对齐，添加了 refX 和 refY 属性指定哪个坐标（标记的坐标系统中）与路径的开始坐标对齐。
          2.orient属性设置maker按照正确的方向展示
          3.markerUnits设置marker的stroke-width是否和被标记物体相同，
            strokeWidth: 使用被标记物体的stroke-width
            userSpaceOnUse: 使用marker自己的stroke-width
        -->
        <marker id="mCircle"
                markerWidth="10"
                markerHeight="10"
                refX="5"
                refY="5">
          <circle cx="5"
                  cy="5"
                  r="4"
                  style="fill: none;stroke: red;" />
        </marker>
        <marker id="mArrow"
                markerWidth="4"
                and
                markerHeight="8"
                refX="0"
                refY="4"
                orient="auto"
                markerUnits="strokeWidth">
          <path d="M 0 0 4 4 0 8"
                style="fill: none; stroke: black;" />
        </marker>
        <marker id="mTriangle"
                markerWidth="5"
                markerHeight="10"
                refX="5"
                refY="5"
                orient="auto">
          <path d="M 0 0 5 5 0 10 Z"
                style="fill: black;" />
        </marker>
      </defs>

      <path d="M200 200
               h200
               a20 20 0 0 1 20 20
               v200"
            style="stroke-width: 10;stroke: red;" />

      <!-- 开始、中间结束使用相同的标记 -->
      <path d="M100 300
               Q0,0 300,100
               Q600,0 500,300
               Q600,600 300,500
               Q0,600 100,300
               M300,300
               C300,300 30
               z"
            style="stroke-width: 1;stroke: blue;fill: none;marker: url(#mCircle);" />

    </svg>

    <script>
      const ele = document.querySelector("#xxx");
      let n = 0;
      function Renderer() {
        n++;
        if (n >= 360) n = 0;
        window.requestAnimationFrame(Renderer);
      }
      // Renderer();
    </script>
  </body>

</html>
